<?php
	require_once dirname(BASEPATH) . '/application/models/local/data/_init_model.php';
	
	class mod_tag extends _init_model
	{
		function mod_tag(){
			parent::__construct();
			$this->tableName = 'tag';
		}
		
		function get_tag(){
			$this->db->order_by('TAG_NAME', 'ASC');
			$query = $this->db->get($this->tableName);
			return $query->result_array();
		}
		function add_tag($tagname){
			$this->db->where('TAG_NAME', $tagname);
			$count = $this->db->count_all_results($this->tableName);
			
			if ($count <= 0){
				$this->db->flush_cache();
				return $this->db->insert($this->tableName, array('TAG_NAME' => $tagname));
			} else 
				return true;			
		}
	}
?>